﻿using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using QxFramework.Core;

public class TileMapItem :PosFixedItem
{
    Sprite originSprite;
    public TileMapItemField NewSetting;
    public override ItemField ItemFieldSetting { get =>NewSetting; set =>NewSetting=(TileMapItemField) value; }
    private void Awake()
    {
        originSprite = this.GetComponent<SpriteRenderer>().sprite;
    }
    public override void OnStart()
    {
        base.OnStart();
        if (GetField<TileMapItemField>().TileMapSpritePath != default)
        {
            this.GetComponent<SpriteRenderer>().sprite = ResourceManager.Instance.Load<Sprite>(GetField<TileMapItemField>().TileMapSpritePath);
        }
        else
        {
            this.GetComponent<SpriteRenderer>().sprite = originSprite;
        }
        if (this.GetComponent<SpriteRenderer>().sprite == null)
        {
            this.GetComponent<SpriteRenderer>().sprite = originSprite;
        }
    }
}
[System.Serializable]
public class TileMapItemField : PosFixedItemField
{
    [HideInInspector]
    public string TileMapSpritePath = default;
}